/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logical.allhit;

import java.io.PrintWriter;
import java.io.StringWriter;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Sanjeet Jha
 */
public class Shutdown extends Thread {

    public Shutdown() {
    }

    @Override
    public void run() {
        try {
            Kernel.getInstance().shutdown();
        } catch (Exception err) {
            StringWriter swriter = new StringWriter();
            PrintWriter writer = new PrintWriter(swriter);
            err.printStackTrace(writer);
            writer.flush();
            JOptionPane.showMessageDialog(new JFrame(), "An unexpected error "
                    + "occurred during application shutdown:\r\n"
                    + swriter.toString(), "ERROR", JOptionPane.ERROR_MESSAGE);
        }
        super.run();
    }
}
